package com.oda.camera.util;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import android.util.Log;

public class SendImage implements ISendImage {
	
	private PathFile liste;
	private List<Integer> idSelectedItem;
	
	public SendImage(PathFile p) {
		super();
		liste=p;
		idSelectedItem=new ArrayList<Integer>();
	}
	
	
	
	@Override
	public PathFile getSelectedImage() {
		return removeReferences(liste);
	}

	@Override
	public void addReference() {
		// TODO Auto-generated method stub
		
	}

	public List<Integer> idSingleton(){
		Set s=new HashSet();
		s.add(idSelectedItem);
		List<Integer> newId=new ArrayList<Integer>(s);
		for(int i:newId){
			Log.d("TAG", "Clean"+i);
		}
		
		return newId;
	}

	@Override
	public PathFile removeReferences(PathFile liste) {
		for(int id:idSelectedItem){
			if(!liste.isEmpty()){
				liste.remove(id);
				Log.d("TAG", "Clean"+id);
			}else{
				Log.d("TAG", "Empty");
			}
		}
		return liste;
	}

	
	
	@Override
	public void addIdItem(int id) {
		idSelectedItem.add(id);	
		Log.d("ITEM", "add "+id);
	}

}
